<?php

	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * Works out the variables in the current scope (from
	 * where the function was called).  Returns an array
	 * with variable name as key and variable value as value.
	 *
	 * Example:		print_r(get_defined_variables(array('GLOBALS', '_FILES', '_COOKIE', '_POST', '_GET'), get_defined_vars()));
	 */
	function get_defined_variables($exclude = array(), $resource = NULL)
	{
		if(is_null($resource) || empty($resource))
		{
			return;
		}
		
		$variables	= array_values(array_diff(array_keys($resource), $exclude));
		$return		= array();
		
		while(list($key, $value) = each($variables))
		{
			global ${$value};
			
			$return[$value] = ${$value};
		}
		
		unset($return['exclude'], $return['return'], $return['resource']);
		
		return($return);
	}

?>